]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
main: Don't override DesktopAppInfo desktop if already GNOME
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 31 Mar 2020 18:13:46 +0000 (20:13 +0200)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 31 Mar 2020 18:27:12 +0000 (20:27 +0200)
During the shell initialization we call the (deprecated) function to
override the Desktop environment in Gio DesktopAppInfo to make sure that
applications are correctly shown (as per commit b2fbf5a2), however this
might break the cases in which $XDG_CURRENT_DESKTOP is already set and
contains GNOME (given that is now a list).

In Ubuntu this is in fact set to: ubuntu:GNOME.
Now, if an application contains NotShowIn=ubuntu, the key will be ignored by
the shell, and the application is still listed everywhere.

So, override the DesktopAppInfo desktop environment only in the case that
the current desktop is not already GNOME.

At the current date I think we could just safely get rid of this override at
all, but there could be still cases where it still might be useful, like when
running as nested in some other environment, so keeping it.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/1156

js/ui/main.js

index ebf9b333a839639838113cdc6bcea621c78a5596..bb579c34744135257afb1d579341d1c026c49390 100644 (file)
@@ -132,7 +132,9 @@ function start() {
         notifyError(msg, detail);
     });
 
-    Gio.DesktopAppInfo.set_desktop_env('GNOME');
+    let currentDesktop = GLib.getenv('XDG_CURRENT_DESKTOP');
+    if (!currentDesktop || !currentDesktop.split(':').includes('GNOME'))
+        Gio.DesktopAppInfo.set_desktop_env('GNOME');
 
     sessionMode = new SessionMode.SessionMode();
     sessionMode.connect('updated', _sessionUpdated);